Add: directory attributes value validations#857
Conversation
There was a problem hiding this comment.
Pull request overview
This PR implements comprehensive validation for directory attribute values in LDAP operations according to Active Directory business logic. The validation rules are determined by the combination of entity type name and attribute name.
- Added
AttributeValueValidatorclass with validation rules for directory attributes acrossadd,modify, andmodifyDnLDAP operations - Introduced
EntityTypeNamesenum to standardize entity type references throughout the codebase - Integrated validation into DAOs, gateways, and LDAP request handlers with proper error handling
Reviewed changes
Copilot reviewed 35 out of 35 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
app/enums.py |
Added EntityTypeNames enum defining standard entity type constants |
app/ldap_protocol/ldap_schema/attribute_value_validator.py |
New validator class implementing business logic rules for attribute values |
app/ldap_protocol/ldap_requests/add.py |
Integrated validation for LDAP add operations with error handling |
app/ldap_protocol/ldap_requests/modify.py |
Added validation to modify operations |
app/ldap_protocol/ldap_requests/modify_dn.py |
Added validation to modifyDn operations |
app/ldap_protocol/ldap_requests/contexts.py |
Extended request contexts to include validator dependency |
app/ldap_protocol/ldap_schema/entity_type_dao.py |
Injected validator and applied validation during entity type operations |
app/ldap_protocol/policies/password/dao.py |
Added validator dependency for password attribute validation |
app/ldap_protocol/auth/setup_gateway.py |
Integrated validator into setup operations |
app/ioc.py |
Registered AttributeValueValidator in dependency injection container |
tests/test_ldap/test_attribute_value_validator.py |
Comprehensive test suite for validator covering all validation rules |
tests/test_api/test_main/test_router/test_add.py |
Extended tests to verify validation behavior in add operations |
| Multiple test files | Updated to use EntityTypeNames enum instead of string literals |
app/constants.py |
Updated entity type data structures to use EntityTypeNames enum |
app/repo/pg/tables.py |
Added database indexes for performance optimization |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 34 out of 34 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 34 out of 34 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 34 out of 34 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
p.s. в ТестКлассах надо сделать свойство для хранения entity_type_name |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 35 out of 35 changed files in this pull request and generated 6 comments.
Comments suppressed due to low confidence (1)
app/constants.py:1
- Removed type ignore comments that are no longer necessary with proper typing.
"""Data variables.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
!!! NOTE: После того как будет аппрув, нужно будет поменять целевую ветку с |
* Add: directory attributes value validations (#857) * Add: addRequest validate `new_name` (#862) * fix: update push branch from main to dev in build workflow (#866) * Http codes with map 774 (#836) * Added dishka container to migrations (#868) * Refactor: integrate NetworkPolicyGateway into LDAP session management (#863) * Add default admin name 1111 (#872) * Refactor syslog-ng configuration and enhance SyslogSender class (#871) * Refactor: git checks (#869) * Add: global LDAP server (#875) * Fix: global ldap server (#877) * Rework dependencies initialization in migrations (#880) * add: UDP port mapping for LDAP service in docker-compose.yml (#882) * Refactor ldap server (#867) * Add: clear user password history (#874) * Fix migration 275222846605 (#881) * Add KRBAPIConnectionError handling to error map in krb5_router.py (#885) * Add: directory is_system (#884) * add: handling KRBAPIConnectionError in KerberosService exceptions (#886) * Refactor: merge enterprise tests (#887) * add: enqueue param for loguru (#888) * Add: tmpfs and volume prune and kadmin_api depends on kdc (#891) * New CI (#890) * add: Contact entity type (#896) * refactor: rename services to System (#883) * Hotfix262 (#898) * Fix: user addRequest: recreate principal if exists already (#897) * Enhance AddRequest: suppress KRBAPIPrincipalNotFoundError during principal deletion (#902) * Refactor: cosmetic (#900) * Add: Global Catalog logger (#892) * Refactor: ModifyRequest (#893) * Fix: Correct path assignment in _update_descendants function (#904) * refactor: fix paths kadmin_api entrypoint (#903) * add: rename services (#905) * fix: replace services with system (#906) --------- Co-authored-by: Milov Dmitriy <milovdd@mail.ru> Co-authored-by: Ruslan <khannanov.rus@gmail.com> Co-authored-by: Misha-Shvets <76677350+Misha-Shvets@users.noreply.github.com> Co-authored-by: Михаил Михайлов <90135860+TheMihMih@users.noreply.github.com>
Задача: 792
Нужно реализовать поддерживаемую и расширяемую валидацию значений атрибутов любой директории согласно бизнес логике AD, правило валидации рассчитывается исходя из пары: Имя сущности (к которой относится директория) + Имя атрибута
Сделано:
add,modify,modifyDnaddзапроса